<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
			
	String adminName = (String)session.getAttribute("adminName");
	if(adminName!=null){
		response.sendRedirect(basePath+"admin/main.jsp");
	}
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>管理平台</title>
<script type="text/javascript" src="js/jquery.min.js"></script>

<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	overflow: hidden;
}

.STYLE3 {
	color: #528311;
	font-size: 12px;
}

.STYLE4 {
	color: #42870a;
	font-size: 12px;
}
-->
</style>
<script type="text/javascript">
$(document).ready(function(){
	$("#loginBt").click(function(){
		if(!check()){
			return;
		}
		var  userName = $("input#userName").val();
		var  passWord = $("input#passWord").val();
		$.ajax({
			type : "POST",
			url : "servlet/AdminLoginServlet",
			data: "userName="+userName+"&passWord="+passWord,
			success : function(result) {
				if(result=="success"){
					window.location.href ="<%=basePath%>admin/main.jsp";
				}else{
					$("#passWord").val("");
					alert("登录失败,请核对您输入的用户名和密码");
				}
			}
		});	
	});
	
	$("#reset").click(function(){
		$("#userName").val("");
		$("#passWord").val("");
	});
	
});


 function check()
 {
     if ($("#userName").val()=="")
     {
        alert("请输入用户名!!!");
 		$("#userName").focus(); 
       return false;
     }
     if ($("#passWord").val()=="")
     {
       alert("请输入密码!!!");
       $("#passWord").focus(); 
       return false;
     }
     return true;
 }
 </script>
</head>

<body>
		<table width="100%" height="100%" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td bgcolor="#e5f6cf">&nbsp;</td>
			</tr>
			<tr>
				<td height="608" background="<%=basePath %>admin/images/login_03.gif"><table
						width="862" border="0" align="center" cellpadding="0"
						cellspacing="0">
						<tr>
							<td height="266" background="<%=basePath %>admin/images/login_04.gif">&nbsp;</td>
						</tr>
						<tr>
							<td height="95"><table width="100%" border="0"
									cellspacing="0" cellpadding="0">
									<tr>
										<td width="424" height="95" background="<%=basePath %>admin/images/login_06.gif">&nbsp;</td>
										<td width="183" background="<%=basePath %>admin/images/login_07.gif"><table
												width="100%" border="0" cellspacing="0" cellpadding="0">
												<tr>
													<td width="21%" height="30"><div align="center">
															<span class="STYLE3">用户</span>
														</div>
													</td>
													<td width="79%" height="30"><input id="userName" type="text"
														name="userName" value=""
														style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;">
													</td>
												</tr>
												<tr>
													<td height="30"><div align="center">
															<span class="STYLE3">密码</span>
														</div>
													</td>
													<td height="30"><input id="passWord" type="password" name="passWord"
														style="height:18px; width:130px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;">
													</td>
												</tr>
												<!--  	<tr>
													<td height="30"><div align="center">
															<span class="STYLE3">验证码</span>
														</div></td>
													<td height="30"><input type="text" name="rand"
														maxlength="4" value=""
														style="height:18px; width:50px; border:solid 1px #cadcb2; font-size:12px; color:#81b432;">
													<div style="height: 18px;width:20px;margin-right:50px; float:right;">	<img height="17px" border="1" src="image.jsp" /></div>
													</td>
												</tr>  -->

												<tr>
													<td height="30">&nbsp;</td>
													<td height="30"><img src="<%=basePath %>admin/images/dl.gif" width="81"
														height="22" border="0" usemap="#Map">
													</td>
												</tr>
											</table>
										</td>
										<td width="255" background="<%=basePath %>admin/images/login_08.gif">&nbsp;</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td height="247" valign="top" background="<%=basePath %>admin/images/login_09.gif"><table
									width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="22%" height="30">&nbsp;</td>
										<td width="56%">&nbsp;</td>
										<td width="22%">&nbsp;</td>
									</tr>
									<tr>
										<td>&nbsp;</td>
										<td height="30"><table width="100%" border="0"
												cellspacing="0" cellpadding="0">
												<tr>
													<td width="44%" height="20">&nbsp;</td>
													<td width="56%" class="STYLE4">版本 2013V1.0</td>
												</tr>
											</table>
										</td>
										<td>&nbsp;</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td bgcolor="#a2d962">&nbsp;</td>
			</tr>
		</table>
		<map name="Map">
			<area shape="rect" coords="3,3,36,19" href="javascript:void(0);"
			 id="loginBt"/>
			<area id="reset" shape="rect" coords="40,3,78,18" href="javascript:void(0);"/>
		</map>

</body>
</html>
